#include "qbytearrayeditor.h"

#include "../property/qabstractproperty.h"

#include <QHBoxLayout>

QByteArrayEditor::QByteArrayEditor(QAbstractProperty *pro,QWidget *parent):
    QAbstractPropertyEditor(pro,parent),
    m_lineedit(new QLineEdit(this))
{
    m_lineedit->setText(pro->get_value().toString());
    connect(m_lineedit,SIGNAL(textChanged(QString)),this,SLOT(value_changed()));
    layout()->addWidget(m_lineedit);
}

void QByteArrayEditor::value_changed()
{
    emit property_changed(m_lineedit->text());
}

void QByteArrayEditor::property_value_changed()
{
    m_lineedit->setText(m_property->get_value().toString());
}

qRegisterPropertyEditor("ByteArray",QByteArrayEditor)
